package components

import (
	"net/http/httptest"

	"github.com/gin-gonic/gin"
)

func NewContext() *gin.Context {
	w := httptest.NewRecorder()
	r := httptest.NewRequest("GET", "/", nil)
	gin.SetMode(gin.TestMode)
	c, _ := gin.CreateTestContext(w)
	c.Request = r
	return c
}

// 生成logid
func NewLogId() string {
	return GetRandomString(12)
}
